class Robot775 extends Thread {

	private Robot337 r337;

	public Robot775(String isim, Robot337 r337) {
		super(isim);
		this.r337 = r337;
	}

	public void run() {
		try {

			System.out.println(this.getName() + " beklemeye basliyor");

			r337.join(); // Robot337 bitene kadar bekle
			// r337.join(150); // Robot337 yi 150 ms bekle
			// r337.join(150, 90); // Robot337 yi 150 ms + 90 ns bekle

			for (int i = 0; i < 5; i++) {
				System.out.println(this.getName() + "<->" + i);
			}
		} catch (InterruptedException iEx) {
			// bosver
		}
	}
}

class Robot337 extends Thread {

	public Robot337(String isim) {
		super(isim);
	}

	public void run() {
		for (int i = 0; i < 5; i++) {
			System.out.println(this.getName() + "<->" + i);
		}
	}
}

public class JoinTest {

	public static void main(String args[]) {

		Robot337 r337 = new Robot337("Robot337");
		Robot775 r775 = new Robot775("Robot775", r337);

		r775.start();
		r337.start();
	}
}
